import org.junit.Test;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;

/**
 * @author 35326
 * @date 2021/3/4 21:44
 *
 */
public class GenericTest {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
        ArrayList<Integer> list = new ArrayList<Integer>();

        list.add(1);

        list.getClass().getMethod("add",Object.class).invoke(list,"asd");
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
    }

    @Test
    public void test1(){
        ArrayList<String> list=new ArrayList();
        ArrayList list1=new ArrayList<String>();
    }

}

class Father<T>{
    T item;

    public T getItem() {
        return item;
    }

    public void setItem(T item) {
        this.item = item;
    }
}

class Son extends Father<Integer>{
    public Integer getItem(){
        return this.item;
    }
    public void setItem(Integer item){
        this.item=item;
    }
}
